package com.woniu.service.impl;

import com.woniu.controller.form.CompanyCount;
import com.woniu.controller.form.UserCount;
import com.woniu.model.BmsTreasureCount;
import com.woniu.dao.BmsTreasureCountMapper;
import com.woniu.model.Order;
import com.woniu.service.IBmsTreasureCountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 平台资产表 服务实现类
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-04-13
 */
@Service
@Transactional
public class BmsTreasureCountServiceImpl extends ServiceImpl<BmsTreasureCountMapper, BmsTreasureCount> implements IBmsTreasureCountService {

    @Resource
    private BmsTreasureCountMapper bmsTreasureCountMapper;

    @Override
    public List<CompanyCount> company(String type) {
            List<CompanyCount> r1 = bmsTreasureCountMapper.queryAllTreasure(type);
            return r1;
    }
    /*查询指定用户的消费记录*/
    @Override
    public List<UserCount> personal(Integer uid) {
        List<UserCount> userCounts = bmsTreasureCountMapper.userCount(uid);
        return userCounts;
    }
    /*统计用户的总消费金额*/
    @Override
    public int countAllConsumed(Integer uid) {
        int total = bmsTreasureCountMapper.countAllConsumed(uid);
        return total;
    }

    @Override
    public int countAllTreasure(String type) {
        int i = bmsTreasureCountMapper.countAllTreasure(type);
        return i;
    }

}
